<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : Admin.xsl
    Created on : May 21, 2013, 1:19 AM
    Author     : TuPA
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html"/>

    <!-- TODO customize transformation rules 
         syntax recommendation http://www.w3.org/TR/xslt 
    -->
    <xsl:template match="products">
        <div class="onecolumn" >
            <div class="content"  >
                <div class="tableName">
                    <h3>Product</h3>

                    <a href="#" onclick="AddProduct()" style="float: left; margin-bottom: 3px; padding-left: 10px">
                        <img src="images/product/newproduct.jpg" height="45px" width="90px"/>
                    </a>
                    <input type="text" name="txtSearch" id="txtSearch" value="" style="float: left; margin-left:920px; margin-bottom: 10px">
                        <img src="images/search_1.jpg" height="30px" style="margin-left: 10px; margin-bottom: 10px" onclick="adminSearch()"/>
                    </input>
                    
                    <table class="border">
                        <thead>
                            <tr>
                                <th class="border">
                                    <div>No.</div>
                                </th>
                                <th class="border">
                                    <div>Name</div>
                                </th>
                                <th class="border">
                                    <div>Image</div>
                                </th>
                                <th class="border">
                                    <div>Sell Price (VND)</div>
                                </th>
                                <th class="border">
                                    <div>Description</div>
                                </th>
                                <th class="border">
                                    <div>Category</div>
                                </th>
                                <th class="border">
                                    <div>Product Type</div>
                                </th>
                                <th class="border">
                                    <div>Quantity</div>
                                </th>
                                <th class="border">
                                    <div>From</div>
                                </th>
                                <th class="border">
                                    <div>Brand</div>
                                </th>
                                <th class="border">
                                    <div>No Sell</div>
                                </th>
                                <th class="border">
                                    <div>Update</div>
                                </th>
                            </tr>
                        </thead>
                        <tbody class="border">
                            <xsl:for-each select="product">
                                <tr>
                                    <td class="border">
                                        <xsl:number level="single" count="product"/>
<!--                                        <xsl:value-of select='proID'/>-->
                                        <input type="hidden" name="txtID" value="{proID}" id="{proID}" />
                                    </td>
                                    <td class="border">
                                        <xsl:value-of select="proName"/>
                                        <input type="hidden" name="txtName" value="{proName}" id="name{proID}" />
                                    </td>
                                    <td class="border">
                                        <img width='50px' height='60px' >
                                            <xsl:attribute name="src">
                                                <xsl:value-of select="Image"/>
                                            </xsl:attribute>
                                        </img>
                                        <input type="hidden" name="txtImage" value="{Image}" id="image{proID}" />
                                    </td>
                                    <td class="border">
                                        <xsl:value-of select="format-number(Price,'###,###,##0')"/>
                                        <input type="hidden" name="txtPrice" value="{Price}" id="price{proID}" />
                                    </td>
                                    <td class="border">
                                        <xsl:value-of select="Description"/>
                                        <input type="hidden" name="txtDes" value="{Description}" id="des{proID}" />
                                    </td>
                                    <td class="border">
                                        <xsl:value-of select="catalogName"/>
                                        <input type="hidden" name="txtCatalog" value="{catalogName}" id="catalog{proID}" />
                                    </td>
                                    <td class="border">
                                        <xsl:if test="(proType='0')">
                                            <select name="" onchange="getValue('{proID}')">
                                                <xsl:attribute name="id">proType<xsl:value-of select='proID'/>
                                                </xsl:attribute>
                                                <option value="0" selected="selected">Normal Product</option>
                                                <option value="1">Hot Product</option>
                                                <option value="2">New Product</option>
                                            </select>
                                        </xsl:if>
                                        <xsl:if test="(proType='1')">
                                            <select name="" onchange="getValue('{proID}')">
                                                <xsl:attribute name="id">proType<xsl:value-of select='proID'/>
                                                </xsl:attribute>
                                                <option value="0">Normal Product</option>
                                                <option value="1" selected="selected">Hot Product</option>
                                                <option value="2">New Product</option>
                                            </select>
                                        </xsl:if>
                                        <xsl:if test="(proType='2')">
                                            <select name="" onchange="getValue('{proID}')">
                                                <xsl:attribute name="id">proType<xsl:value-of select='proID'/>
                                                </xsl:attribute>
                                                <option value="0">Normal Product</option>
                                                <option value="1">Hot Product</option>
                                                <option value="2" selected="selected">New Product</option>
                                            </select>
                                        </xsl:if>
                                    </td>
                                   <td class="border">
                                        <xsl:value-of select="proNumber"/>
                                        <input type="hidden" name="txtNumber" value="{proNumber}" id="proNum{proID}" />
                                    </td>
                                    <td class="border">
                                        <xsl:value-of select="proFrom"/>
                                        <input type="hidden" name="txtFrom" value="{proFrom}" id="proFrom{proID}" />
                                    </td>
                                    <td class="border">
                                        <xsl:value-of select="brandName"/>
                                        <input type="hidden" name="txtBrand" value="{brandName}" id="brandName{proID}" />
                                    </td>
                                     <td class="border">
                                        <xsl:if test="not(noSell='0')">
                                            <input type="checkbox" name="option1Sell" checked="true" id="noSell{proID}" onchange="getValue('{proID}')"/>
                                        </xsl:if>
                                        <xsl:if test="noSell='0'">
                                            <input type="checkbox" name="option2Sell" id="noSell{proID}" onchange="getValue('{proID}')"/>
                                        </xsl:if>
                                    </td>
                                    <td class="border">
                                        <input type="button" value="Edit" name="btAction" onclick="editProductDetail('{proID}')"/>
                                    </td>
                                </tr>
                            </xsl:for-each>
                        </tbody>
                    </table>

                </div>
            </div>
        </div>
    </xsl:template>

</xsl:stylesheet>
